package com.lagou.task18;

public class ThreadJoinTest extends Thread {
    @Override
    public void run() {
        //模拟倒数10个数
        System.out.println("倒计时开始。。。");
        for (int i = 10; i > 0 ; i--) {
            System.out.println(i);
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("新年快乐");
    }

    public static void main(String[] args) {
        ThreadJoinTest tj1 = new ThreadJoinTest();
        tj1.start();

        System.out.println("主线成等待子线程。。。");
        try {
            tj1.join();

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("终于等到你结束了");
    }
}
